package com.itheima.io.bufferedwriter.demo03;

import java.io.*;

public class CopyFileDemo03 {

    public static void main(String[] args) throws IOException {

        BufferedReader bufferedReader = new BufferedReader(new FileReader("itheima-io-bufferedwriter\\b.txt"));
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("itheima-io-bufferedwriter\\c.txt"));

//        int ch = -1;
//        while ((ch = bufferedReader.read()) != -1){
//            bufferedWriter.write(ch);
//        }

//        char[] chars = new char[1024];
//        int len = -1;
//        while ((len = bufferedReader.read(chars)) != -1){
//            bufferedWriter.write(chars, 0, len);
//        }

        String line = null;
        while ((line = bufferedReader.readLine()) != null){
            bufferedWriter.write(line);
            bufferedWriter.newLine();
            bufferedWriter.flush();
        }



        bufferedWriter.close();
        bufferedReader.close();

    }


}
